<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
function validate(){
	if(form.title.value==""){
		alert("标题不能为空");	
		return false;
	}
	if(form.content.value==""){
		alert("内容不能为空");	
		return false;
	}

}
</script>
<title>Write</title>
</head>
<body>
     <% 
      Object obj=session.getAttribute("logged");
      if(obj==null||!obj.toString().equals("1")){
   	   out.println("<script>alert('请先登录！');window.location='Login.html'</script>");
      }
      %>
            <h2 style="color:#520941">请写下你的文章</h2>
                <form action="WriteServlet" method="post" name="form" onsubmit="return validate()">
                <p>文章标题:</p><input name="title">
                <p>文章内容:</p><textarea rows="40" cols="180" id="content" name="content"></textarea>
                <br/>
                <input type="submit" value="提交">
                <button onclick="window.location.href='index1.jsp'">返回</button>
                </form>

</body>
</html>